//
//  DHRadioReadView.m
//  Moment
//
//  Created by dllo on 15/12/26.
//  Copyright © 2015年 片刻. All rights reserved.
//

#import "DHRadioReadView.h"

@implementation DHRadioReadView
-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubView];
    }
    return self;
}

-(void)setPlayerRadio:(DHREPlayeRadio *)playerRadio{
    if (_playerRadio !=playerRadio ) {
        _playerRadio = playerRadio;
    }
    NSLog(@"_playerRadio -****==  %@",_playerRadio.playinfo.title);
    NSURL *url = [NSURL URLWithString: _playerRadio.playinfo.webview_url];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [self.webView loadRequest:request];
}
- (void)createSubView{
    self.backgroundColor = [UIColor whiteColor];
    
    
    self.webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0,SCREEN_WIDTH , self.frame.size.height)];
    [self addSubview:self.webView];
  
    self.webView.delegate = self;
    
    self.webView.scrollView.contentMode = UIViewContentModeScaleAspectFit;
    _webView.scrollView.bounces = NO;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
